Complex functions¶
A complex function is a function that has a subset of the complex numbers as a domain and the complex numbers as a codomain:
We say that \(f\) is a function of a complex variable. A complex function \(f(z)\) may also be resolved into its real part \(u(x, y)\) and imaginary part \(v(x, y)\):
where \(u\) and \(v\) are functions of two real variables.
Polynomials¶
A complex polynomial of \(n\)-th degree is a function \(p : \mathbb{C} \to \mathbb{C}\) of the form
where \(a_0, \dots, a_n \in \mathbb{C}\) are the coefficients of the polynomial and \(a_n \neq 0\). A polynomial of \(n\)-th degree has exactly \(n\) roots, but some of them may be equal.
For example, the function \(p(z) = 2z^4 + (2-3i)z^2 + 1\) is a third degree (complex) polynomial.
Rational functions¶
A rational function is a function of the form
where \(p\) and \(q\) are polynomials. The natural domain of \(r\) is the set of all complex numbers such that \(q\) is not a null-polynomial,
For example, the function
has a domain \(D = \{ z \in \mathbb{C} : z^2 + 3 \neq 0 \} = \mathbb{C} \setminus \{ \pm i \sqrt{3} \}\).
Exponential function¶
The complex exponential function \(\exp : \mathbb{C} \to \mathbb{C}\) is defined by extending the Taylor series of the real exponential to complex numbers. TODO: put this example somewhere?
This is what allows us to represent complex numbers in polar form. The usual properties of an exponential function still apply:
It is easy to separate \(e^z\) into its real \(u(x, y)\) and imaginary \(v(x, y)\) part: $ \text{Re}(e^z) = e^x \cos y$, \(\text{Im}(e^z) = e^x \sin y\).
import numpy as np
import plotly.offline
import plotly.graph_objects as go
x = np.linspace(-2, 2, 101)
y = np.linspace(-10, 10, 501)
X, Y = np.meshgrid(x, y)
f = np.exp(X) * np.exp(1j*Y)
fig = go.Figure(data=[go.Surface(z=f.real, x=x, y=y)])
fig.update_layout(title='Real part of exp(z)', autosize=True)
fig
Or both the real and imaginary part as a heat map:
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 2, figsize=(8, 8), sharey=True)
im = ax[0].contourf(f.real, levels=12, cmap='inferno', extent=[-2, 2, -10, 10])
ax[0].contour(f.real, levels=12, colors='k', extent=[-2, 2, -10, 10], linewidths=1.)
fig.colorbar(im, ax=ax[0])
ax[0].set_title('Real')
ax[0].set_xlabel('x')
ax[0].set_ylabel('y')
im = ax[1].contourf(f.imag, levels=12, cmap='inferno', extent=[-2, 2, -10, 10])
ax[1].contour(f.imag, levels=12, colors='k', extent=[-2, 2, -10, 10], linewidths=1.)
fig.colorbar(im, ax=ax[1])
ax[1].set_title('Imaginary')
ax[1].set_xlabel('x')
plt.tight_layout()
plt.show()
Notice that a complex exponential function consists of a growing/decaying part \(e^x\) and a periodic/oscillating part \(\cos y + i \sin y\). Therefore, the complex exponential function is also periodic with a period \(2\pi i\):
Whether \(e^x\) will grow or decay depends on the sign of \(x\); it will grow if \(x > 0\) and it will decay if \(x < 0\). If \(x=0\) it will just oscillate with unit amplitude, it will neither grow nor decay. Let us calculate the magnitude and phase of \(e^z\):
Since \(e^x > 0\) for all \(x\), we conclude that \(e^z \neq 0\) for all \(z \in \mathbb{C}\). So \(0\) is not in the image of the exponential function, but all other complex numbers are.
Remember that the argument is periodic.
fig, ax = plt.subplots(1, 2, figsize=(8, 8), sharey=True)
im = ax[0].contourf(np.abs(f), levels=12, cmap='inferno', extent=[-2, 2, -10, 10])
ax[0].contour(np.abs(f), levels=12, colors='k', extent=[-2, 2, -10, 10], linewidths=1.)
fig.colorbar(im, ax=ax[0])
ax[0].set_title('abs')
ax[0].set_xlabel('x')
ax[0].set_ylabel('y')
# We could have imported cmath and then cmath.phase(f)
im = ax[1].contourf(np.arctan2(f.imag, f.real), levels=12, cmap='inferno', extent=[-2, 2, -10, 10])
ax[1].contour(np.arctan2(f.imag, f.real), levels=12, colors='k', extent=[-2, 2, -10, 10], linewidths=1.)
fig.colorbar(im, ax=ax[1])
ax[1].set_title('phase')
ax[1].set_xlabel('x')
plt.tight_layout()
plt.show()
Logarithm¶
We would like to extend the idea of a logarithm being the inverse of the exponential function, but since the complex exponential function is not bijective, the inverse function does not exist. What we mean is that the logarithm cannot be a single-valued function since \(z = |z| e^{i(arg(z) + 2n \pi)}\) has the same value of the logarithm for all integers \(n\) since it is periodic. However, as we saw above, the complex exponential function is injective on an interval of length \(2 \pi\) so we can define an inverse on that interval.
Since the exponential function maps a sum to a product (i.e. $ e^{a+b} = e^a e^b $), the logarithm of a product must be equal to the sum of their logarithms (i.e. $ \ln(z_1 z_2) = \ln(z_1) + \ln(z_2) $):
As with the argument (note the capital \(Arg\) and \(Ln\)), we define the principal value of a logarithm for \(n = 0\):
Trigonometric and hyperbolic functions¶
Trigonometric and hyperbolic functions of a complex variable are defined with the exponential function:
Properties
We can check directly that the following is valid:
Addition formulae are valid:
and